// __PUBLIC__/js/page/cms/block/addblock
require(['../../common'], function() {
  require(['block.addblock'])
})

define('block.addblock', [
  'jquery',
  'jqp/validate'
], function($) {
  'use strict';

  var $form = $('#J_form')
  $form.validate({
    classPlace: '.kv',
    errorPlace: '.kv-error',
    errors: {
      'blockname': {
        required: '区块名称不能为空'
      },
      'number': {
      	digits: '请输入整数'
      },
      'template': {
        required: '模版内容不能为空'
      }
    }
  });
  var btnSelect = $('#btn-select'),
      rowNumber = $('#row-number');
  btnSelect.on('change',function(){
      if(1 == $(this).val()){
          rowNumber.css({display:"block"});
      }else if(2 == $(this).val()){
          //静态区块隐藏
          rowNumber.css({display:"none"});
      }
  });    
  
})
